 <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工程合同查询</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../../resources/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../resources/css/style.css" media="all">
    <style>
        .layui-input-inline{width: 80%!important;}
    </style>
</head>
<body>
<a class="dayin" id="dlink" type="button"   style="float: right; position: fixed; right: 50px; bottom: 50px; z-index: 999;"></a>
<form class="layui-form layui-form-pane" action="" >
    <div class="formTop" style="font-size:12px;">
        <div class="layui-form-item layui-col-lg3 layui-col-sm3">
            <div class="layui-input-inline">
                <input type="text" name="username" lay-verify="required" placeholder="项目名称" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline layui-col-lg3 layui-col-sm3">
            <div class="layui-input-inline">
                <input type="text" class="layui-input" id="test-limit3" placeholder="请选择创建开始日期">
                <div class="icons">

                </div>
            </div>
        </div>
        <div class="layui-inline layui-col-lg3 layui-col-sm3">

            <div class="layui-input-inline">
                <input type="text" class="layui-input" id="test-limit4" placeholder="请选择创建结束日期">
                <div class="icons">

                </div>
            </div>
        </div>

        <div class="layui-col-lg3 layui-col-sm3">
            <button class="layui-btn" type="button" onclick="query()">查询</button>

        </div>

    </div>

    <table id="demo" lay-filter="test"></table>

    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-sm chakan quanxian" lay-event="detail" QX="api/matperson/loadghMoudle.do">查看</a>
    </script>





</form>

<script src="../../../resources/layui/layui.js" charset="utf-8"></script>
<script src="../../../resources/js/style.js"></script>
<script src="../../../resources/js/api.js"></script>
<script>

    function query() {
        layui.use(['form', 'layedit', 'laydate','table','element'], function() {
            var form = layui.form
                , table = layui.table;
            var pronName=$("[name='username']").val();
            var begintime=$('#test-limit3').val();
            var endtime=$('#test-limit4').val();
            var state=$('[name="quiz1"]').val();



            if(!AntiSqlValid(pronName)){
                if(lbq('api/contract/builContrSel.do')){
                    API.contractQuery({'proName':pronName,'begintime':begintime,'endtime':endtime,'state':state,'p':getCookie('yanzheng')})
                }

            }else {
                layer.msg('请勿输入特殊符号或敏感文字');
            };
        })

    }


    layui.use(['form', 'layedit', 'laydate','table'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,table=layui.table
            ,laydate = layui.laydate;
        jiazais();

        //前后若干天可选，这里设置不能选过去的日期      最远可选1000天之后
        panduanshijiantow('#test-limit3','#test-limit4',1000,1000,'.layui-btn-normal');     //查询 开始结束时间判断

        if(lbq('api/contract/builContrSel.do')) {

            API.contractQuery({'p': getCookie('yanzheng')})            //获取到的数据传入列表进行渲染
        }
        dayintishi('.dayin');

        //监听工具条
        table.on('tool(test)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值
            var tr = obj.tr; //获得当前行 tr 的DOM对象

            if(layEvent === 'detail'){ //查看
                //do somehing
                //console.log(obj)


                sessionStorage.id=obj.data.cc_UUID;         //缓存id 至详情页调用
                window.location.href='../../management/contracrAdmin/details.html';
            } else if(layEvent === 'del'){ //删除
                layer.confirm('确认删除？', function(index){
                    obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                    layer.close(index);
                    //向服务端发送删除指令
                });
            } else if(layEvent === 'edit'){ //编辑
                //do something
                //console.log(obj)
                sessionStorage.id=obj.data.cc_uuid;         //缓存id 至修改页调用
                window.location.href='./modify.html';

            }
        });


    })

</script>
</body>
</html>